import Axios from 'axios'

const state = {
	countryData: [],
	countryId: [],		//国家id
	provinceId: [],		//省份id
	loading: [true]
}

const mutations = {
	updateCountryId(state, id) {
		state.countryId.splice(0, 1, id);
	},
	updateProvinceId(state, id) {
		state.provinceId.splice(0, 1, id);
	},
	updateLoading(state, bool) {
		state.loading.splice(0, 1, bool);
	},
	updateCountryData(state, arr) {
		let countryData = state.countryData;
		countryData.length = 0;
		if(arr.length > 0) {
			countryData.splice(0, 1, ...arr);
		} else {
			countryData.splice(0);
		}
	}
}

const actions = {

}


export default {
	namespaced: true,
	state,
	mutations,
	actions
}